/**
 * @作者:黎谢之
 * @创建时间：2021/7/7
 * @修改时间：2021/7/10
 */
package com.example.senior_bug.controller;


import com.example.senior_bug.ToolClass.Result;
import com.example.senior_bug.Service.CategoryService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@CrossOrigin
@RequestMapping("/Category")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    //用户二级页面获取二级分类列表
    @RequestMapping("/getList")
    public Result GetCategoriesByChannel(@RequestParam(required = true) String ChannelName) {
        return categoryService.GetCategoriesByChannel(ChannelName);
    }

    //通过ID查询单个二级分类
    @RequestMapping("/getById")
    public Result GetCategoryById(@RequestParam(required = true) int Id) {
        return categoryService.GetCategoryById(Id);
    }

}
